package threadLocal;

/**
 * @author wang'ji'cheng
 * @date 2025/7/29
 * 资源；类
 */
public class ResourceDemo {
    /**
     * 线程变量类，绑定的数据类型是String
     */
    private ThreadLocal<String> data = new ThreadLocal<>();

    //从线程变量类中取东西
    public String get(){
        return Thread.currentThread().getName()+"----------"+data.get();
    }

    //给线程变量类添加东西
    public void set(String string){
        data.set(string);
    }
}
